/* soivpste.p - POST INVOICES TO AR AND GL REPORT                       */
/* Copyright 1986-2003 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.6.2.3.3.1 $                                                     */
/*V8:ConvertMode=Maintenance                                            */
/* REVISION: 7.2      LAST MODIFIED: 11/12/94   BY: rxm *FT54*          */
/* REVISION: 7.2      LAST MODIFIED: 03/13/95   BY: jxz *F0M3*          */
/* REVISION: 7.3      LAST MODIFIED: 09/05/95   BY: jym *G0W9*          */
/* REVISION: 7.3      LAST MODIFIED: 11/14/96   BY: ame *G2J1*          */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane    */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 08/13/98   BY: *J2VM* Irine D'mello*/
/* REVISION: 9.1      LAST MODIFIED: 06/27/00 BY: *N0DM* Rajinder Kamra */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KN* myb            */
/* REVISION: 9.1      LAST MODIFIED: 10/13/00   BY: *N0W8* Mudit Mehta  */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.6.2.3.3.1 $    BY: Ashish Maheshwari     DATE: 10/20/03  ECO: *P15L*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
         {mfdeclre.i}
{cxcustom.i "SOIVPSTE.P"}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */
/* DEFINITION FOR TEMP TABLE  t_tr_hist1 */
{sotrhstb.i}
define input  parameter table          for  t_tr_hist1.
         define shared variable sonbr like sod_nbr.
         define shared variable soline like sod_line.
         define shared variable sopart like sod_part.
         define shared variable lotserial_total like tr_qty_chg.
define shared variable undo_all        like mfc_logic no-undo.
{&SOIVPSTE-P-TAG1}
do transaction on error undo, leave:
   /* MAKE SURE ORACLE DOES NOT PICK TR_TYPE INDEX */
   {&SOIVPSTE-P-TAG2}
   for each t_tr_hist1 no-lock
      where t_tr_type = "ISS-SO"
        and t_tr_nbr = sonbr
        and t_tr_rmks = ""
        and t_tr_line = soline
        and t_tr_serial <> ""
        {&SOIVPSTE-P-TAG3}
        use-index t_hist1_indx
        break by t_tr_serial by t_tr_ref by t_tr_expire with frame d:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame d:handle).

      if first(t_tr_expire)
      then do:
         if page-size - line-counter < 1
         then do:
                     page.
                     clear frame d all no-pause.
                     clear frame can-d all no-pause.
                     display
                        sopart
               "**" + getTermLabel("CONTINUE",8) + "**" @ sod_qty_inv
                     with frame d.
                     down 1 with frame d.
         end. /* IF page-size ... */
                  put {gplblfmt.i
                        &FUNC=getTermLabel(""LOT/SERIAL_NUMBERS_SHIPPED"",25)
                        &CONCAT="': '"
                      } at 5
                      {gplblfmt.i
                        &FUNC=getTermLabelRt(""Qty"",6)
                        &CONCAT="' '"
                      }
                      {gplblfmt.i
                        &FUNC=getTermLabelRt(""EXPIRE"",8)
                      }
                      {gplblfmt.i
                        &FUNC=getTermLabelRt(""REFERENCE"",15)
                      }
            skip.
      end. /* IF FIRST(t_tr_expire) ... */
      if first-of(t_tr_expire)
      then
         lotserial_total = 0.

      lotserial_total = lotserial_total - t_tr_qty_loc.

      if last-of(t_tr_expire)
         and lotserial_total <> 0
      then do:
         if page-size - line-counter < 1
         then do:
                     page.
                     clear frame d all no-pause.
                     display
                         sopart
               "**" + getTermLabel("CONTINUE",8) + "**" @ sod_qty_inv
                     with frame d.
                     down 1 with frame d.
         end. /* IF page-size ... */
         put t_tr_serial at 7
                      lotserial_total at 27
            t_tr_expire at 42
            t_tr_ref at 54
                      skip.
      end. /* IF LAST-OF(t_tr_expire) ... */
   end. /* FOR EACH t_tr_hist1 */
   return.
end. /* DO TRANSACTION */
undo_all = yes.
